import 'package:flutter/material.dart';

class SectionTitle extends StatelessWidget {
  final String title;
  final String? subtitle;
  final IconData? icon;

  const SectionTitle({
    super.key,
    required this.title,
    this.subtitle,
    this.icon
  });


  @override
  Widget build(BuildContext context) {
    return Padding(padding: const EdgeInsets.only(top: 16.0, bottom: 8.0),
        child: Row(
          crossAxisAlignment: CrossAxisAlignment.center,
          children: [
            if(icon != null)
              Padding(padding: const EdgeInsets.only(right: 8.0),
                child: Icon(icon, color: Theme
                    .of(context)
                    .primaryColor,),),
            Expanded(child: Column(crossAxisAlignment: CrossAxisAlignment.start,
              children: [
                Text(title, style: const TextStyle(
                    fontSize: 18, fontWeight: FontWeight.bold),),
                if(subtitle != null)
                  Padding(padding: const EdgeInsets.only(top: 4.0),
                    child: Text(subtitle!, style: TextStyle(
                        fontSize: 14, color: Colors.grey[600]),),),
              ],
            ))
          ],
        ));
  }

}